package cn.jia.rabbitmq.producer;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: jia
 * @Descirption:
 * @Date: 2018/4/20 11:21
 * @Modified By:
 */

@Component
public class RabbitProducerImpl implements RabbitProducerInterface{
    @Autowired
    private AmqpTemplate amqpTemplate;
    @Override
    //第一个参数为交换机的名称，第二个为路由的key
    public void sendMessage(String exchange,String queueKey, Object object){
        amqpTemplate.convertAndSend(exchange,queueKey,object);
        System.out.println("----消息发送完成---");
    }
}
